PowerShell Studio contains the Script Packager™, which can package single or multiple scripts, supporting files, and COM components into a single, standalone executable file (.exe).
You can create an executable file package for scripts and supporting files. After you set up the Script Packager, you can create scripts by clicking the Package button.
If this is your first package, begin by setting up the Script Packager.
PowerShell Studio checks the syntax of the packaged files and compiles them into an executable file (.exe).
If your build is successful, the Build window displays information about the new executable file:
PowerShell Studio makes it easy to customize the executable files that you create. If you have never used the Script Packager in PowerShell Studio, when you click Package, PowerShell Studio opens the Packager Settings window.
The Script Packager contains everything you need to create your package.
Field Name | Description |
Output file |
Path and filename of the executable. |
Platform |
The platform that runs the scripts in the package. Each package contains only one platform. To include more than one script type in an executable file, create an MSI file. |
STA Mode |
Single-threaded apartment. The default is multi-threaded apartment. |
Icon file (optional) |
A custom icon (.ico) for the executable. |
Manifest creation |
Options for the manifest file, including a custom manifest.
|
Custom manifest |
Opens a file to the specified line. |
Alternate credentials |
Uses the credentials of the specified user to run the scripts in the executable file. |
Run mode |
Current user: Runs scripts with the permissions of the user who runs the executable file. RunAs: Runs scripts with the permissions of the specified user in the specified user's environment. Impersonate user: Switches to the security context of the specified user, but uses the environment (e.g. network profiles, mapped drives, environment variables) of the current user. |
Signing |
For detailed instructions about installing certificates, see "Script Signing" in Windows Script Host and Windows PowerShell Features. |
WScript and CScript can run VBS and JS files. They write the script as a temporary file which is removed after the package completes. SAPIEN Script Host can run VBS and JS files. It executes entirely in-memory and does not use temporary files. The SAPIEN Script Host is included in the package and does not need to be deployed in advance. Windows PowerShell can run PS1 files. PowerShell must already been installed wherever you will be executing the packaged script. MSHTA runs HTA files.
By default, the scripts in a package run in the security context of the user who runs the package. However, you can specify alternate credentials (a user name and password) that will be used to run the scripts. The alternate credentials you supply must be available (either as local or domain accounts) on any computer where the compiled package will run. In addition, the credentials must generally have local administrator privileges on the computer where the compiled package will run. To specify a domain, use username@domainname format, not domain\user format. Do not specify a domain or computer name for local accounts.
To run a script elevated ("Run as administrator"):
Do not add an elevation manifest to the empty executable. If you do, the system prompts for credentials (unavailable to the non-administrator user) before running.
Use the Execution Restrictions to limit the environment in which the package runs.
Use the Version Information settings to specify characteristics of the current version of the executable file. The version number must be in #.#.#.# format.
You can create executable packages for VBScript (VBS files), JScript (JS files), Windows PowerShell scripts (PS1 files), and HTML Applications (HTA) files. However, because the package contains one script engine, basic packages can contain only one type of script.
To create a package with multiple script types, create a Microsoft Installer (MSI) file.